package com.ruoyi.web.controller.system;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.SysKey;
import com.ruoyi.system.service.SysUserKeyService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.ArrayList;

@RestController
@RequestMapping(value = "/sysUserKey")
public class SysUserKeyController extends BaseController {

    @Resource
    SysUserKeyService sysUserKeyService;

    @GetMapping(value = "selectSysKeyList")
    private TableDataInfo demo() {
        startPage();
        ArrayList<SysKey> sysKeys = sysUserKeyService.selectSysKeyList();
        return getDataTable(sysKeys);
    }

    /**
     * @Deprecated 新增自己的卡密
     */
    @PostMapping(value = "/addKey")
    private AjaxResult addKey(@RequestBody SysKey sysKey) {
        return sysUserKeyService.addKey(sysKey);
    }


    /**
     * @Deprecated 删除自己的卡密
     */
    @PostMapping(value = "/delKey")
    private AjaxResult delKey(@RequestBody SysKey sysKey) {
        return sysUserKeyService.delKey(sysKey);
    }

    /**
     * @Deprecated 封停卡密
     */
    @PostMapping("/shutDown")
    private AjaxResult shutDown(String key) {
        return sysUserKeyService.shutDown(key);
    }
}
